package ee.ut.sysmodel.bgmn.model;

public class Goal extends Pin {
	private static final int P1_GOAL_POSITION = BoardState.PIN_COUNT + 1;
	private static final int P2_GOAL_POSITION = 0;
	
	public Goal(Player owner) {
		super(owner.getIdentity() == Player.Identity.PLAYER_ONE ? P1_GOAL_POSITION : P2_GOAL_POSITION);
		
		pieceOwner = owner;
	}
	
	@Override
	public boolean isOwned() {
		return true;
	}
	
	@Override
	public int getPieceCount() {
		return pieceOwner.getGoalCount();
	}
	
	@Override
	public void setState(Player owner, int amount) {
		pieceOwner.setGoalCount(amount);
	}
	
	@Override
	public void removePiece() throws BackgammonException {
		throw new BackgammonException("Can't remove pieces from the goal");
	}
}
